#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
PyQt5 tutorial 

In this example, we dispay an image
on the window.

author: py40.com
last edited: 2017年3月
"""
import sys
from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QLabel, QApplication)
from PyQt5.QtGui import QPixmap


class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        hbox = QHBoxLayout()
        pixmap = QPixmap("img/icon_icon.png")

        lbl = QLabel('Python',self)
        lbl.setPixmap(pixmap)

        hbox.addStretch(1)
        hbox.addWidget(lbl)
        hbox.addStretch(1)
        self.setLayout(hbox)

        self.setGeometry(300, 300, 500, 300)
        self.setWindowTitle('pixmap')
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())

